package main

import (
  "sdl"
  "sdl/ttf"
  //"log"
)

type Label struct {
  Base
  text    string
}

func NewLabel(x, y, w, h int, text string) *Label {
  label := new(Label)
  label.x = x
  label.y = y
  label.w = w
  label.h = h
  label.text = text
  return label
}


func (d *Label) draw(surface *sdl.Surface) {

  surface.FillRect(&sdl.Rect{int16(d.x), int16(d.y), uint16(d.w), uint16(d.h)}, 0x004400);
  
  text := ttf.RenderText_Blended(GetFont(), d.text, sdl.Color{255, 255, 255, 0})
  surface.Blit(&sdl.Rect{int16(d.x) + 5, int16(d.y + 5), 0, 0}, text, nil)
  text.Free()
  
  //log.Stderrf("Drawing window %p", d)
}
